package com.kgc.cgprovider.dao;

import com.kgc.cgapi.pojo.PurchaseInvoice;
import com.kgc.cgapi.pojo.PurchaseInvoiceDetail;
import com.kgc.store.pojo.KcInstore;
import com.kgc.store.pojo.KcInstoreDetail;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

public interface PurchaseInvoiceMapper {

    List<PurchaseInvoice> selectPurchaseInvoiceByPage(@RequestBody Map<String, Object> map);

    int insertPurchaseInvoice(PurchaseInvoice purchaseInvoice);

    //根据供应商（pid）查询对应采购入库单
    List<KcInstore> selectPurchaseInstoreByPid(@RequestParam("supplierId") int supplierId);

    //根据选择的源单查询采购入库明细
    List<KcInstoreDetail> selectPurchaseInstoreDetailByInstoreCode(@RequestParam("instoreCode") String instoreCode);

    //根据单据编号查询采购发票(回显)
    PurchaseInvoice selectPurchaseInvoiceByCode(@RequestParam("code") String code);

    //根据单据编号查询采购发票(回显)
    List<PurchaseInvoiceDetail> selectPurchaseInvoiceDetailByCode(@RequestParam("invoiceCode") String invoiceCode);

    //采购发票明细
    int insertPurchaseInvoiceDetail(PurchaseInvoiceDetail purchaseInvoiceDetail);

    int deletePurchaseInvoice(@RequestParam("id") int id);

    //根据单据编号删除主表数据
    int deletePurchaseInvoiceByCode(String code);

    //根据关联的单据编号删除明细表数据
    int deletePurchaseInvoiceDetailByCode(String code);

}
